package com.clstu.homeworks.homework04;

public class Test {
    public static void main(String[] args) {
        Employee[] arr=new Employee[5];//多态数组，向上转型
        arr[0]=new Peasant("jack",200,30);
        arr[1]=new Scientist("Anne",300,25);
        arr[2]=new Teacher("Tracy",260,20);
        arr[3]=new Waiter("Mary",170,31);
        arr[4]=new Worker("Dien",400,29);
        for (int i = 0; i < arr.length; i++) {
            arr[i].say();//动态绑定机制，调用方法看运行类型，
        }
    }
}
